<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('兼任历史查询')"/>
    <th:block th:include="include :: layout-latest-css"/>
    <th:block th:include="include :: ztree-css"/>
    <th:block th:include="include :: bootstrap-editable-css"/>
    <th:block th:include="include :: container-css"/>
    <th:block th:include="include :: select2-css"/>
</head>
<style>
    .fixed-table-container .bs-checkbox .th-inner {
        padding: 8px 8px !important;
    }

</style>
<body class="gray-bg">
<div class="modal inmodal fade" id="myModal1" tabindex="-1" role="dialog" aria-hidden="true">
    <div class="modal-dialog modal-sm">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span
                        class="sr-only">Close</span>
                </button>
                <h4 class="modal-title">兼任历史查询</h4>
            </div>
            <div class="modal-body">
                <p>
                    兼任日期从:
                <div class="input-group date">
                    <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
                    <input type="text" id="BeginDate" class="form-control laydate-demo-1" placeholder="yyyy-MM-dd">
                </div>
                </p>
                <p>
                    兼任日期到:
                <div class="input-group date">
                    <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
                    <input type="text" id="EndDate" class="form-control laydate-demo-2" placeholder="yyyy-MM-dd">
                </div>
                </p>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-white" id="close" data-dismiss="modal">关闭</button>
                <button type="button" class="btn btn-primary" onclick="getData()">确定</button>
            </div>
        </div>
    </div>
</div>
<div class="container-div">
    <div class="row">
        <div class="col-sm-12 search-collapse">
            <form id="formId">
                <div class="select-list">
                    <ul>
                        <li>
                            <p>工号：</p>
                            <input type="text" name="badge"/>
                        </li>
                        <li>
                            <p>姓名：</p>
                            <input type="text" name="name"/>
                        </li>
                        <li>
                            <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i
                                    class="fa fa-search"></i>&nbsp;搜索</a>
                            <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i
                                    class="fa fa-refresh"></i>&nbsp;重置</a>
                        </li>
                    </ul>
                </div>
            </form>
        </div>


        <div class="col-sm-12 select-table table-striped">
            <table id="bootstrap-table" data-mobile-responsive="true"></table>
        </div>
    </div>
</div>
<th:block th:include="include :: footer"/>
<th:block th:include="include :: layout-latest-js"/>
<th:block th:include="include :: ztree-js"/>
<th:block th:include="include :: bootstrap-table-editable-js"/>
<th:block th:include="include :: hr-help-js"/>
<th:block th:include="include :: datetimepicker-js"/>

<script th:inline="javascript">

    var prefix = ctx + "changeManage/EmpConcurrentlyManage";
    $(function () {
        $("#myModal1").modal('show');

        layui.use('laydate', function () {
            var laydate = layui.laydate;
            laydate.render({
                elem: '.laydate-demo-1',
                type: 'date'
            });

        });
        layui.use('laydate', function () {
            var laydate = layui.laydate;
            laydate.render({
                elem: '.laydate-demo-2',
                type: 'date'
            });

        });
    });

    function getData() {
        var beginDate = $("#BeginDate").val();
        var endDate = $("#EndDate").val();
        var columns = [];
        var id = {field: 'id', title: '序号'};
        var badge = {field: 'badge', title: '工号'};
        var name = {field: 'name', title: '姓名'};
        var compName = {field: 'compName', title: '公司名称'};
        var depName = {field: 'depName', title: '部门名称'};
        var jobName = {field: 'jobName', title: '工作岗位'};
        var empStatusName = {field: 'empStatusName', title: '员工状态'};
        var joinDate = {field: 'joinDate', title: '入职日期'};
        var partCompIDTitle = {field: 'partCompIDTitle', title: '兼任公司'};
        var partDepIDTitle = {field: 'partDepIDTitle', title: '兼任部门'};
        var partJobIDTitle = {field: 'partJobIDTitle', title: '兼任岗位'};
        var reason = {field: 'reason', title: '兼任原因'};
        var begin = {field: 'beginDate', title: '兼任开始日期'};
        var isover = {
            field: 'isover',
            title: '兼任是否结束',
            formatter: function (value, row, index) {
                return showCheck(row);
            }
        };
        var end = {field: 'endDate', title: '兼任结束日期'};
        var remark = {field: 'remark', title: '备注'};
        var regName = {field: 'regName', title: '登记人'};
        var regDate = {field: 'regDate', title: '登记时间'};
        var initializedName = {field: 'initializedName', title: '确认人'};
        var initializedTime = {field: 'initializedTime', title: '确认时间'};
        var closedName = {field: 'closedName', title: '封存人'};
        var closedTime = {field: 'closedTime', title: '封存时间'};

        columns.push(id, badge, name, compName, depName, jobName, empStatusName, joinDate, partCompIDTitle, partDepIDTitle, partJobIDTitle,
            reason, begin, isover, end, remark, regName, regDate, initializedName, initializedTime, closedName, closedTime);

        $("#close").click();
        var options = {
            url: prefix + "/historyList?beginDate=" + beginDate + "&endDate=" + endDate,
            height: $(window).height() - 120,
            modalName: "兼任历史查询",
            columns: columns
        };
        $.table.init(options);
    }

    function showCheck(row) {
        if (row.isover) {
            return '<i class="fa fa-toggle-on text-info fa-2x"></i> ';
        } else {
            return '<i class="fa fa-toggle-off text-info fa-2x"></i> ';
        }
    }

</script>
</body>
</html>